Demote duplicate build target error to a warning
authorAlex Crichton <alex@alexcrichton.com>
Fri, 5 Aug 2016 16:07:18 +0000 (09:07 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 5 Aug 2016 16:07:18 +0000 (09:07 -0700)
Added in #2847 this ended up unfortunately breaking the `regex` crate on
nightly, so let's just issue a warning for awhile first. Eventually we can
promote this to an error if it becomes a problem.

src/cargo/util/toml.rs
tests/build.rs

index 43ec13c265c5d96d5ec1e50caaa7340d5183622a..9a7e2135a17d370fb7c70618cd822ec905e99b84 100644 (file)
@@ -536,7 +536,8 @@ impl TomlManifest {
         }
 
         if let Err(e) = unique_build_targets(&targets, layout) {
-            bail!("duplicate build target found: `{}`", e);
+            warnings.push(format!("file found to be present in multiple \
+                                   build targets: {}", e));
         }
 
         let mut deps = Vec::new();
index 1e85bbf7c23b0413c11036ba208afed3c06c3920..4f74335b8c5ecd3bcd1b9f3ce6c34dbb122a11b5 100644 (file)
@@ -117,21 +117,18 @@ fn cargo_compile_duplicate_build_targets() {
             [dependencies]
         "#)
         .file("src/main.rs", r#"
+            #![allow(warnings)]
             fn main() {}
         "#);
 
-    let error_message = format!("\
-[ERROR] failed to parse manifest at `[..]`
-
-Caused by:
-  duplicate build target found: `{}`",
-                     p.root().join("src[..]main.rs").display());
-
     assert_that(p.cargo_process("build"),
                 execs()
-                .with_status(101)
-                .with_stderr(error_message)
-    )
+                .with_status(0)
+                .with_stderr("\
+warning: file found to be present in multiple build targets: [..]main.rs
+[COMPILING] foo v0.0.1 ([..])
+[FINISHED] [..]
+"));
 }
 
 #[test]